﻿@model List<EclecticListEntry>

@{
    ViewBag.Title = "Eclectic Worst";
    var today = DateTime.Today;
    var actionName = "EclecticWorst";
}

<div class="page-header">
    <h1><span class="glyphicon glyphicon-tower"></span> @ViewBag.Title</h1>
</div>
<ul class="pagination">
    <li>@Html.ActionLink("i dag", actionName, new { date = today.ToString("yyyy-MM-dd") })</li>
    <li>@Html.ActionLink("i går", actionName, new { date = today.AddDays(-1).ToString("yyyy-MM-dd") })</li>
    <li>@Html.ActionLink("i forgårs", actionName, new { date = today.AddDays(-2).ToString("yyyy-MM-dd") })</li>
    <li>@Html.ActionLink("7 dage siden", actionName, new { date = today.AddDays(-7).ToString("yyyy-MM-dd") })</li>
    @foreach (Season s in ViewBag.Seasonlist)
    {
        <li>@Html.ActionLink(s.Name, actionName, new { date = s.EndDate.ToString("yyyy-MM-dd") })</li>
    }
</ul>

<h2>Stilling @ViewBag.SeasonName</h2>
<hr />
<table class="table">
    <thead>
        <tr>
            <th class="text-center">#</th>
            <th>
                spiller
            </th>
            <th class="text-center">ialt</th>
            @for (int n = 1; n < 19; n++)
            {
                <th class="text-center">@n</th>
            }
            <th class="text-center">runder</th>
        </tr>
    </thead>

    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td class="text-center">
                    @Html.DisplayFor(modelItem => item.TiedPositionIndicator)@Html.DisplayFor(modelItem => item.Position)
                </td>
                <td>
                    <span class="hidden-xs hidden-sm">
                        @Html.DisplayFor(modelItem => item.Player.DisplayName)
                    </span>
                    <span class="hidden-md hidden-lg">
                        @Html.DisplayFor(modelItem => item.Player.Initials)
                    </span>
                </td>
                <td class="text-center">
                    <b>
                        @if (item.Total < 0)
                        {
                            <span style="color: red">@Html.DisplayFor(modelItem => item.Total)</span>
                        }
                        else
                        {
                            if (item.Total == 0)
                            {
                                <span style="color: green">PAR</span>
                            }
                            else
                            {
                                <span style="color: blue">+@Html.DisplayFor(modelItem => item.Total)</span>
                            }
                        }
                    </b>
                </td>
                <td class="@item.ScoreCssClass(1) text-center">@Html.DisplayFor(modelItem => item.S1)</td>
                <td class="@item.ScoreCssClass(2) text-center">@Html.DisplayFor(modelItem => item.S2)</td>
                <td class="@item.ScoreCssClass(3) text-center">@Html.DisplayFor(modelItem => item.S3)</td>
                <td class="@item.ScoreCssClass(4) text-center">@Html.DisplayFor(modelItem => item.S4)</td>
                <td class="@item.ScoreCssClass(5) text-center">@Html.DisplayFor(modelItem => item.S5)</td>
                <td class="@item.ScoreCssClass(6) text-center">@Html.DisplayFor(modelItem => item.S6)</td>
                <td class="@item.ScoreCssClass(7) text-center">@Html.DisplayFor(modelItem => item.S7)</td>
                <td class="@item.ScoreCssClass(8) text-center">@Html.DisplayFor(modelItem => item.S8)</td>
                <td class="@item.ScoreCssClass(9) text-center">@Html.DisplayFor(modelItem => item.S9)</td>
                <td class="@item.ScoreCssClass(10) text-center">@Html.DisplayFor(modelItem => item.S10)</td>
                <td class="@item.ScoreCssClass(11) text-center">@Html.DisplayFor(modelItem => item.S11)</td>
                <td class="@item.ScoreCssClass(12) text-center">@Html.DisplayFor(modelItem => item.S12)</td>
                <td class="@item.ScoreCssClass(13) text-center">@Html.DisplayFor(modelItem => item.S13)</td>
                <td class="@item.ScoreCssClass(14) text-center">@Html.DisplayFor(modelItem => item.S14)</td>
                <td class="@item.ScoreCssClass(15) text-center">@Html.DisplayFor(modelItem => item.S15)</td>
                <td class="@item.ScoreCssClass(16) text-center">@Html.DisplayFor(modelItem => item.S16)</td>
                <td class="@item.ScoreCssClass(17) text-center">@Html.DisplayFor(modelItem => item.S17)</td>
                <td class="@item.ScoreCssClass(18) text-center">@Html.DisplayFor(modelItem => item.S18)</td>
                <td class="text-center">@Html.DisplayFor(modelItem => item.NumberOfRounds)</td>
            </tr>
        }
    </tbody>
</table>
